package com.mygain.mes.controller;

import com.mygain.mes.entity.TaskOrderToMaterialGroup;
import com.mygain.mes.enums.ResponseCodeEnum;
import com.mygain.mes.service.ActFeignService;
import com.mygain.mes.service.ActProcService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Slf4j
@Controller
//@RequestMapping("/feign")
//@RestController
public class ActFeignController extends ActBaseController {
    @Autowired
    ActFeignService actFeignService;
    @Autowired
    ActProcService actProcService;

    @PreAuthorize("@ss.hasAnyPermi('act#feign/getTaskOrderToMaterialGroupApprovalMsgByTaskIOrderId')")
    @ApiOperation(value = "获取任务单审批材料组相关数据", notes = "获取任务单审批材料组相关数据")
    @GetMapping("/getTaskOrderToMaterialGroupApprovalMsgByTaskIOrderId")
    @ResponseBody
    public Map<String, Object> getTaskOrderToMaterialGroupApprovalMsgByTaskIOrderId(HttpServletRequest request,String taskOrderId) {

    }
    @PreAuthorize("@ss.hasAnyPermi('act#activiti/createModel')")
    @RequestMapping("createModel")
    public void createModel(HttpServletRequest request) {

    }

    @Autowired
    ActProcService actProcService;


	@PreAuthorize("@ss.hasAnyPermi('act#activiti/model/{modelId}/json')")
	@RequestMapping(value="/model/{modelId}/json")
	public ObjectNode getEditorJson(@PathVariable("modelId") String modelId) {

	}
    @PreAuthorize("@ss.hasAnyPermi('system#menu/addMenuInfo')")
    @ApiOperation(value = "添加菜单信息", notes = "添加菜单信息")
    @RequestMapping(value = "/addMenuInfo", method = {RequestMethod.POST})
    @ResponseBody
    public Map<String, Object> addMenuInfo(HttpServletRequest request, @RequestBody SysMenu sysMenu) {
    }

    @PreAuthorize("@ss.hasAnyPermi('act#addPurchaseApplyApproval')")
    @ApiOperation(value = "采购申请审批", notes = "采购申请审批")
    @PostMapping("/addPurchaseApplyApproval")
    @ResponseBody
    @NoRepeatSubmit
    public Map<String, Object> addPurchaseApplyApproval(HttpServletRequest request, @RequestBody PurchaseApplyApprovalRequest purchaseApplyApprovalRequest) {
        super.setStartTime();
        try {
            CommonResult commonResult = this.actApprovalService.addPurchaseApplyApproval(purchaseApplyApprovalRequest);
            this.resultMap = super.generateResponseData(request, commonResult, startTime);
            return resultMap;
        } catch (Exception e) {
            e.printStackTrace();
            this.resultMap = super.generateResponseData(request, ResponseCodeEnum.EXIST_EXCEPTION, startTime, e.getMessage());
            return resultMap;
        }
    }

}
